#!/usr/bin/env python

# WS client example

import asyncio
import websockets

async def hello():
    async with websockets.connect('ws://localhost:3000', compression=None) as websocket:
        p = {"command": "login",
             "id": 1,
             "sender": "jason",
             "password": "123456"}
        import json
        # name = input("What's your name? ")
        login = json.dumps(p)
        await websocket.send(login)
        print(f"> {login}")
        response = await websocket.recv()
        print(f"< {response}")

asyncio.get_event_loop().run_until_complete(hello())


# c = client.connect('ws://localhost:3001')
# print(dir(c))
# c.send("Jim")
# print(c.recv())